/**
 * @param {number[][]} matrix
 * @param {number} target
 * @return {boolean}
 */
// 暴力查找，没有超时，但是复杂度太高
var searchMatrix = function (matrix, target) {
  let xlen = matrix.length;
  let ylen = matrix[0].length;
  for (let i = 0; i < xlen; i++) {
    for (let j = 0; j < ylen; j++) {
      if (target === matrix[i][j]) return true;
    }
  }
  return false;
};

var searchMatrix = function (matrix, target) {
  const xlen = matrix.length;
  for (let i = 0; i < xlen; i++) {
    if (matrix[i].includes(target)) {
      return true;
    }
  }

  return false;
};

// 二分搜索方式
